#!/bin/sh -x

# build base freebsd system

# import variables
. scripts/vars.sh

# check if we have all the directories that we need
if [ ! -d ${GYPSY_WORLDDIR} ]; then
	mkdir -p ${GYPSY_WORLDDIR}
fi

cd $SRCDIR
make -j4 \
     __MAKE_CONF=${GYPSY_DIR}/conf/make.conf \
     buildworld

make -j4 \
    __MAKE_CONF=${GYPSY_DIR}/conf/make.conf \
    KERNCONFDIR=${GYPSY_DIR}/conf \
    KERNCONF=GYPSYBSD \
    buildkernel

make -j4 \
    __MAKE_CONF=${GYPSY_DIR}/conf/make.conf \
    DESTDIR=${GYPSY_WORLDDIR} \
    hierarchy installworld

cd etc
make -j4 \
    __MAKE_CONF=${GYPSY_DIR}/conf/make.conf \
    DESTDIR=${GYPSY_WORLDDIR} \
    distribution

cd ..
make -j4 \
    __MAKE_CONF=${GYPSY_DIR}/conf/make.conf \
    DESTDIR=${GYPSY_WORLDDIR} \
    KERNCONFDIR=${GYPSY_DIR}/conf \
    KERNCONF=GYPSYBSD \
    installkernel

cd ${GYPSY_DIR}
